package edu.yuhf.entity;

import static javax.persistence.GenerationType.SEQUENCE;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity		//声明这是一个实体类
@Table(name="USERS")	//声明该类对应的表名
public class User  implements java.io.Serializable {

     private Long id;
     private String name;
     private String password;

    public User() {
    }

    public User(String name, String password) {
        this.name = name;
        this.password = password;
    }

    @SequenceGenerator(name="generator",sequenceName="user_id",allocationSize=1)	//指定Oracle中的序列名
    @Id 	//声明当前属性是主键属性，即OID
    @GeneratedValue(strategy=SEQUENCE, generator="generator")	//声明当前属性的生成策略
    @Column(name="ID", unique=true, nullable=false, precision=10, scale=0)
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    //声明name属性对应的表中的列。
    @Column(name="NAME", nullable=false, length=50)
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name="PASSWORD", nullable=false, length=50)
    public String getPassword() {
        return this.password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
}